package cn.itcast.travel.web.servlet.blogger;

import cn.itcast.travel.service.BloggerService;
import cn.itcast.travel.service.impl.BloggerServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "Deleteone", value = "/Deleteone")
public class Deleteone extends HttpServlet {
    BloggerService service=new BloggerServiceImpl();
    //删除发表过的文章或者收藏的文章
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String which=request.getParameter("which");
        String bgid=request.getParameter("bgid");
        String bloggerid=request.getParameter("bloggerid");
        service.deleteblog(which,bgid,bloggerid);
        ObjectMapper ob=new ObjectMapper();
        ob.writeValue(response.getWriter(),1);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
